function AddSection(oActive)
{
if (oActive == null)
{
alert(LOCID_FORMED_MUSTSELECT);
return false;
}
var oArgs = new Object();
var currentTabName = GetCurrentTabName(oActive);
var oTab = GetTabNode(currentTabName);
if (oTab.getAttribute("locklevel") == "1")
{


alert(LOCID_FORMED_ADDSECLOCKEDTAB);
return;
}
oArgs.Section	= new SectionObj(currentTabName, "", false, false, false,null,"varwidth","11");
oArgs.FormXml	= oFormXml;

var oSection = openStdDlg(prependOrgName("/Tools/FormEditor/Dialogs/section.aspx?title=") + encodeURI( LOCID_FORMED_ADDSECTION ) + "&description=" + encodeURI( LOCID_FORMED_ADDSECTIONDESC ), oArgs, 500, 570, true);
if (oSection && AddSectionXml(oSection))
{
AddSectionHtml(oSection);
}
}
function UpdateSection(oActive)
{
var sSectionName = oActive.name;
var oSection = GetSectionNode(sSectionName);
var sTabName	    = oSection.parentNode.parentNode.getAttribute("name");
var bShowLabel	    = (oSection.getAttribute("showlabel") == "true");
var bShowBar	    = (oSection.getAttribute("showbar") == "true");
var bLockSection	= (oSection.getAttribute("locklevel") == "1");
var iLabelWidth		= oSection.getAttribute("labelwidth");
var layout = oSection.getAttribute("layout");
var columns;

if(layout == null)
{
layout = "varwidth";
columns = "11";
}
else
{
columns = oSection.getAttribute("columns");
}
var oLabels		= GetLocalizedObjsArray(oSection.selectNodes("/entity/form/tabs/tab/sections/section[@name = '" + sSectionName + "']/labels/label"));
var oSectionObj = new SectionObj(sTabName, sSectionName, bShowLabel, bShowBar,bLockSection,oLabels,layout,columns,iLabelWidth);
var oArgs = new Object();
oArgs.Section	= oSectionObj;
oArgs.FormXml	= oFormXml;

var oUpdatedSectionObj = openStdDlg(prependOrgName("/Tools/FormEditor/Dialogs/section.aspx?title=") + encodeURI( LOCID_FORMED_SECPROPS ) + "&description=" + encodeURI( LOCID_FORMED_MODIFYSECPROPS ), oArgs, 350, 570, true);
if (oUpdatedSectionObj)
{
if (GetDescByLangCode(oSectionObj.Labels) != GetDescByLangCode(oUpdatedSectionObj.Labels) || (oSectionObj.TabName != oUpdatedSectionObj.TabName) || (oSectionObj.ShowLabel != oUpdatedSectionObj.ShowLabel) || (oSectionObj.ShowBar != oUpdatedSectionObj.ShowBar) || (oSectionObj.LockSection != oUpdatedSectionObj.LockSection) || (oSectionObj.LabelWidth != oUpdatedSectionObj.LabelWidth))
{
UpdateSectionXml(oSectionObj, oUpdatedSectionObj);
UpdateSectionHtml(oActive, oSectionObj, oUpdatedSectionObj);
}
}
}
function AddSectionXml(oSectionObj)
{
if (oSectionObj.SectionName == null || oSectionObj.SectionName.length == 0)
{
return false;
}
var oSections = GetSectionsNode(oSectionObj.TabName);
var oSection = oFormXml.createElement("section");
oSection.setAttribute("name", oSectionObj.SectionName);
oSection.setAttribute("showlabel", oSectionObj.ShowLabel.toString());
oSection.setAttribute("showbar", oSectionObj.ShowBar.toString());
oSection.setAttribute("locklevel", "0");
oSection.setAttribute("id", oSectionObj.SectionName);
oSection.setAttribute("IsUserDefined", "1");


oSection.setAttribute("layout",oSectionObj.Layout);
oSection.setAttribute("columns", oSectionObj.Columns);
oSection.setAttribute("labelwidth", oSectionObj.LabelWidth);
oSection.appendChild(oFormXml.createElement("labels"));
oSection.appendChild(oFormXml.createElement("rows"));
oSections.appendChild(oSection);
PersistLocalizedNodes(oFormXml, "/entity/form/tabs/tab/sections/section[@name = '" + oSectionObj.SectionName + "']/labels/label", oSectionObj.Labels);
return true;
}


function UpdateSectionXml(oSectionObj, oUpdatedSectionObj)
{
var oSection = GetSectionNode(oSectionObj.SectionName);


oSection.setAttribute("name", oUpdatedSectionObj.SectionName);
oSection.setAttribute("showlabel", oUpdatedSectionObj.ShowLabel.toString());
oSection.setAttribute("showbar", oUpdatedSectionObj.ShowBar.toString());
oSection.setAttribute("locklevel", oUpdatedSectionObj.LockSection == true ? "1" : "0");
oSection.setAttribute("labelwidth", oUpdatedSectionObj.LabelWidth.toString());
PersistLocalizedNodes(oFormXml, "/entity/form/tabs/tab/sections/section[@name = '" + oUpdatedSectionObj.SectionName + "']/labels/label", oUpdatedSectionObj.Labels);


if (oSectionObj.TabName != oUpdatedSectionObj.TabName)
{
var oTab =  GetTabNode(oUpdatedSectionObj.TabName);
oTab.lastChild.appendChild(oSection);
}
}


function AddSectionHtml(oSectionObj)
{


var sSectionHtml = "<table name='" + oSectionObj.SectionName + "' cellspacing='4' cellpadding='4' class='section' onclick='SetActiveObject();' ondblclick='ViewPropertiesNow();' valign='top' height='1%' width = '100%' style='table-layout: fixed;'><col/><col/><tr><td colspan='2' class='section' style='";
if (!oSectionObj.ShowLabel)
{
sSectionHtml += "color: #cccccc;";
}
if (oSectionObj.ShowBar)
{
sSectionHtml += "border-bottom: 1px solid #606050;";
}
sSectionHtml += "'>" + (oSectionObj.LockSection == true ? "<img alt='" + LOCID_FORMEDITOR_SECTION_LOCKED + "' class='imgLock' src='/_imgs/tools/ico_lock.gif' />" : "") +
GetDescByLangCode(oSectionObj.Labels) + "</td></tr></table>";
var oTab = window.document.all(Gettabid(oSectionObj.TabName));
var oRow = oTab.children[0].insertRow(oTab.children[0].rows.length - 1);
var oCell = oRow.insertCell();
oCell.style.height = "1%";
oCell.innerHTML = sSectionHtml;
ClickTabByName(oSectionObj.TabName);
oCell.firstChild.click();
}
function UpdateSectionHtml(oActive, oSectionObj, oUpdatedSectionObj)
{
var oSection;
var oTab = window.document.all(Gettabid(oSectionObj.TabName));
var i;
var iLen = oTab.children[0].rows.length;
for (i = 0; i < iLen; i++)
{
oSection = oTab.children[0].rows[i].children[0].children[0];
if (oSection.name == oSectionObj.SectionName)
{
break;
}
}
if (oSectionObj.TabName != oUpdatedSectionObj.TabName)
{
var oNewTab = window.document.all(Gettabid(oUpdatedSectionObj.TabName));
var oNewTbody = oNewTab.children[0].children[0];
var oSectionRow = oSection.parentElement.parentElement;
var oLastRow = oNewTbody.lastChild;
oNewTbody.insertBefore(oSectionRow.parentElement.removeChild(oSectionRow),oLastRow);
ClickTabByName(oUpdatedSectionObj.TabName);
oSection = oSectionRow.firstChild.firstChild;
}
oSection.name = oUpdatedSectionObj.SectionName;


var oSectionTd = oSection.rows[0].cells[0];
if(oUpdatedSectionObj.LockSection)
{
oSectionTd.innerHTML = "<img alt='" + LOCID_FORMEDITOR_SECTION_LOCKED + "' class='imgLock' src='/_imgs/tools/ico_lock.gif' />";
}
else
{
oSectionTd.innerHTML = "";
}

oSectionTd.innerHTML += GetDescByLangCode(oUpdatedSectionObj.Labels);


if (oUpdatedSectionObj.ShowLabel)
{
oSectionTd.style.color = "#606050";
}
else
{
oSectionTd.style.color = "#cccccc";
}


if (oUpdatedSectionObj.ShowBar)
{
oSectionTd.style.borderBottom = "1px solid #606050";
}
else
{
oSectionTd.style.borderBottom = "";
}

oSectionTd.click();
}
function RemoveSection(oActive)
{
var oSection = oFormXml.selectSingleNode("/entity/form/tabs/tab/sections/section[@name = '" + oActive.name + "']");
if (oSection.parentNode.parentNode.getAttribute("locklevel") == "1")
{

alert(LOCID_FORMED_REMOVESECLOCKEDTAB);
return false;
}
if (oSection.getAttribute("locklevel") == "1")
{

alert(LOCID_FORMED_REMOVESECLOCKED);
return false;
}
var oNodes = oSection.selectNodes("rows/row/cell/control");
if (!IsRemovable(oNodes))
{
alert(LOCID_FORMED_REMOVESECLOCKEDFLD);
return false;
}
var sfieldList = GetDependentList(oNodes, true);
if (sfieldList.length > 0 )
{

alert(LOCID_FORMED_SECTABDEPENDENT_HD + "\n\n" + LOCID_FORMED_SECTABDEPENDENT_TL + "\n\n" + sfieldList + "\n\n" + LOCID_FORMED_SECTABDEPENDENT_FT);
return false;
}
RemoveSectionXml(oActive);
RemoveSectionHtml(oActive);
return true;
}
function RemoveSectionXml(oActive)
{
var oSection = GetSectionNode(oActive.name);
oSection.parentNode.removeChild(oSection);
}
function RemoveSectionHtml(oActive)
{
ClickTabByName(GetCurrentTabName(oActive));
oActive.parentElement.parentElement.parentElement.removeChild(oActive.parentElement.parentElement);
}
function RefreshCellHtml(sTabName,sSectionName,sFieldName)
{
var oTab = window.document.all(Gettabid(sTabName));
var oSection;
var i;

var iLen = oTab.children[0].rows.length;
for (i = 0; i < iLen; i++)
{
oSection = oTab.children[0].rows[i].children[0].children[0];
if (oSection.name == sSectionName)
{
break;
}
}
RefreshSectionHtml(oSection,sFieldName);
}
var _oXmlDoc ;
var _oXslDoc ;
var _oXslt ;
var _oXslProc;
function LoadXmlForSectionTransform()
{
if(_oXmlDoc == null)
{
_oXmlDoc = CreateXmlDocument();
_oXslDoc = CreateXmlDocument(true);
_oXslDoc.load("/Tools/FormEditor/formeditorsection.xsl");
_oXslt = CreateXslTemplate();
_oXslt.stylesheet = _oXslDoc;
_oXslProc = _oXslt.createProcessor();

_oXmlDoc.loadXML("<entity><form><section></section></form>" +
"<metadata>" + oFieldsXml.selectSingleNode("/entity/fields").xml + "</metadata>" +
"<properties>" + oPropertiesXml.selectSingleNode("/entity/fields").xml + "</properties>" +
"<strings><lockedsection>" + LOCID_FORMEDITOR_SECTION_LOCKED + "</lockedsection></strings></entity>");
}
}




function RefreshSectionHtml(oSection,sClickCellName)
{
var oSectionRow = oSection.parentElement.parentElement;
var oNewSectionCell =  oSectionRow.insertCell();
var sectionNode = GetSectionNode(oSection.name);
var height = sectionNode.getAttribute("height");
switch(height)
{
case null:
oNewSectionCell.style.height = "1%";
break;
case "auto":
oNewSectionCell.style.height = "100%";
break;
default:
oNewSectionCell.style.height = height;
}
LoadXmlForSectionTransform();
var sectionNodeForTransform = sectionNode.cloneNode(true);
var oldSectionNodeInTransform = _oXmlDoc.selectSingleNode("/entity/form/section") ;
oldSectionNodeInTransform.parentNode.replaceChild(sectionNodeForTransform,oldSectionNodeInTransform);

var propertiesNodeForTransform = oPropertiesXml.selectSingleNode("/entity/fields").cloneNode(true);
var oldPropertiesNodeInTransform = _oXmlDoc.selectSingleNode("/entity/properties/fields") ;
_oXmlDoc.selectSingleNode("/entity/properties").replaceChild(propertiesNodeForTransform,oldPropertiesNodeInTransform);
_oXslProc.input = _oXmlDoc;
_oXslProc.addParameter("languageCode", USER_LANGUAGE_CODE);
_oXslProc.addParameter("mode", _sMode);
_oXslProc.transform();
var updatedXml = _oXslProc.output;
oNewSectionCell.innerHTML = updatedXml;
oSectionRow.removeChild(oSection.parentElement);
var oSectionTable = oNewSectionCell.firstChild;

if(sClickCellName != null)
{
var cells = oSectionTable.getElementsByTagName("TABLE");
for(var i = 0 ; i < cells.length ; i ++)
{
if(cells[i].parentElement.name == sClickCellName)
{
cells[i].parentElement.click();
break;
}
}
}
return oNewSectionCell.firstChild;
}


var _section;
var _totalColumns;
var _columns;
var _name;


function RegenerateXmlFromSchema(oRows)
{
var fieldNames = new Array(_totalColumns);
var totalRows = _section[0].length;
var tempRow = oFormXml.createElement("row");

var nextRow;
for(var iRow = 0 ; iRow < totalRows ; iRow++)
{
nextRow = oRows.childNodes[iRow];
if (nextRow == null)
{
nextRow = oFormXml.createElement("row");
oRows.appendChild(nextRow);
}
var iPosition = 0;
var nextCell = null;
for(var  iColumn = 0 ; iColumn < _totalColumns ; iColumn++)
{

if(_section[iColumn][iRow] != fieldNames[iColumn] || _section[iColumn][iRow] == "")
{
fieldNames[iColumn] = _section[iColumn][iRow];
nextCell = nextRow.childNodes[iPosition];

if(nextCell == null ||
(GetFieldName(nextCell) != fieldNames[iColumn]) )
{
var newCell;
if(fieldNames[iColumn] == "")
{
newCell = CreateNewCell(iColumn);
}
else
{

newCell = oRows.selectSingleNode("row/cell[control/@id = '" + fieldNames[iColumn] + "']");
if(newCell == null)
{
newCell = tempRow.selectSingleNode("cell[control/@id = '" + fieldNames[iColumn] + "']");
}
}
nextRow.insertBefore(newCell,nextCell);
nextCell = newCell;
}
nextCell.setAttribute("colspan",_columns.substr(iColumn,1));
iPosition++;
}
}
var deleteCell = null;
if(nextCell == null)
{
deleteCell = nextRow.firstChild;
while(deleteCell != null)
{
tempRow.appendChild(nextRow.removeChild(deleteCell));
deleteCell = nextRow.firstChild;
}
}
else
{
deleteCell = nextCell.nextSibling;
while(deleteCell != null)
{
tempRow.appendChild(nextRow.removeChild(deleteCell));
deleteCell = nextCell.nextSibling;
}
}
}
var deleteRow;

if(nextRow == null)
{
oRows.selectNodes("row").removeAll;
}
else
{
deleteRow = nextRow.nextSibling;
while(deleteRow != null)
{
oRows.removeChild(deleteRow);
deleteRow = nextRow.nextSibling;
}
}
tempRow.selectNodes("cell").removeAll;
tempRow = null;
}


function CreateSectionSchema(sName,oRows,sColumns)
{
if(_name != sName)
{
_name = sName;
_columns = sColumns;
_totalColumns = _columns.length;
var iRows = oRows.childNodes.length;
_section = new Array(_totalColumns);
for(var i = 0 ; i < _totalColumns ; i ++)
{
_section[i] = new Array(iRows);
}
for(var i = 0 ; i < iRows ; i++)
{
oRow = oRows.childNodes[i];
var cLen = oRow.childNodes.length;
for(var j = 0 ; j < cLen ; j++)
{
var iRowSpan = GetRowSpan(oRow.childNodes[j]);
var fieldName = "";
var oControl = oRow.childNodes[j].selectSingleNode("control");
if(oControl != null)
{
fieldName = oControl.getAttribute("id");
}
var iColumn =  j ;
while(_section[iColumn][i] != null)
{
iColumn++;
}

for(var r = 0 ; r < iRowSpan ; r ++)
{
_section[iColumn][i+r] = fieldName;
}
}
}
}
}
function CreateNewCell(iColumn)
{
var oCell = oFormXml.createElement("cell");
oCell.appendChild(oFormXml.createElement("labels"));
oCell.setAttribute("showlabel", "true");
oCell.setAttribute("colspan" ,_columns.substr(iColumn,1));
return oCell;
}
function GetFieldName(oCell)
{
var fieldName = "";
var oControl = oCell.selectSingleNode("control");
if(oControl != null)
{
fieldName = oControl.getAttribute("id");
}
return fieldName;
}
function MoveDownInSchema(sFieldName)
{
var totalRows = _section[0].length;
var nextRow = -1;
var iRow = 0;
var bmoved = false;
var position = GetPosition(sFieldName);
var iColumn = position[0];
var thisRow = position[1];
if(thisRow < 0 ) return false;
for(iRow = thisRow;iRow < totalRows ; iRow++)
{
if(_section[iColumn][thisRow] != _section[iColumn][iRow])
{
nextRow = iRow;
break;
}
}
var field2 = _section[iColumn][nextRow];
if(field2 != "" && iRow < totalRows)
{
while(iRow < totalRows && field2 == _section[iColumn][iRow])
{
var temp = _section[iColumn][thisRow];
_section[iColumn][thisRow] = _section[iColumn][nextRow];
_section[iColumn][nextRow] = temp;
thisRow++;
nextRow++;
iRow++;
}
bmoved = true;
}
return bmoved;
}

function MoveUpInSchema(sFieldName)
{
var bmoved = false;
var position = GetPosition(sFieldName);
var iColumn = position[0];
var thisRow = position[1];
if(thisRow > 0)
{
bmoved = MoveDownInSchema(_section[iColumn][thisRow - 1]);
}
return bmoved;
}
function DeleteFromSchema(sFieldName,bDeleteEmptyRows)
{
var totalRows = _section[0].length;
var nextRow = -1;
var iRow = 0;
var position = GetPosition(sFieldName);
var iColumn = position[0];
var thisRow = position[1];
if(thisRow < 0 ) return false;

for(iRow =thisRow ;iRow < totalRows ; iRow++)
{
if(_section[iColumn][thisRow] != _section[iColumn][iRow])
{
nextRow = iRow;
break;
}

nextRow = totalRows;
}
var row3 = nextRow;
while(iRow < totalRows && _section[iColumn][iRow] != "")
{
_section[iColumn][thisRow] = _section[iColumn][nextRow];
_section[iColumn][nextRow] = "";
thisRow++;
nextRow++;
iRow++;
}
while(thisRow < row3)
{
_section[iColumn][thisRow] = "";
thisRow++;
}
if(bDeleteEmptyRows)
{
RemoveEmptyRows(totalRows);
}
return true;
}
function RemoveEmptyRows(totalRows)
{

var minLength = GetMinimumLength(totalRows);
for(iCol = 0 ; iCol < _totalColumns ; iCol++)
{
_section[iCol].length = minLength;
}
}
function GetPosition(sFieldName)
{
var position = new Array(-1,-1);
var totalRows = _section[0].length;
for(var iRow = 0 ; iRow < totalRows ; iRow++)
{
for(var iColumn = 0 ; iColumn < _totalColumns ; iColumn++)
{
if(_section[iColumn][iRow] == sFieldName)
{
position[0] = iColumn;
position[1] = iRow;
break;
}
}
if(iColumn < _totalColumns)
{
break;
}
}
return position;
}


function AddCellToSchema(oCell,iRowSpan)
{
var totalRows = _section[0].length;
var sFieldName = oCell.selectSingleNode("control").getAttribute("id");
var position = GetPosition("");
var iColumn = position[0];
var thisRow = position[1];
if(thisRow < 0 )
{
thisRow = totalRows;
iColumn = 0;
}
oCell.setAttribute("colspan",_columns.substr(iColumn,1));
while(iRowSpan > 0 && thisRow < totalRows)
{
_section[iColumn][thisRow] = sFieldName ;
iRowSpan--;
thisRow++;
}

for(var i = iRowSpan ; i > 0 ; i--)
{
for(var iCol = 0 ; iCol < _totalColumns ; iCol++)
{
_section[iCol].length = totalRows;
if(iCol != iColumn)
{
_section[iCol][totalRows] = "";
}
else
{
_section[iCol][totalRows] = sFieldName;
}
}
totalRows++;
}
return true;
}
function MoveLeftInSchema(sFieldName)
{
var totalRows = _section[0].length;
var position = GetPosition(sFieldName);
var iColumn = position[0];
var thisRow = position[1];

if(thisRow < 0 || iColumn == 0)
{
return false;
}
var span = 0;
var iRow = thisRow;
while(_section[iColumn][iRow] == sFieldName && iRow < totalRows)
{
span++;
iRow++;
}
DeleteFromSchema(sFieldName,false);
return InsertAtRowColumn(sFieldName,iColumn - 1,thisRow,span);
}
function InsertAtRowColumn(sFieldName,iColumn,iRow,iSpan)
{

if(_section[iColumn][iRow] == "")
{
while(_section[iColumn][iRow -1] == "" && iRow > 0 )
{
iRow--;
}
for(var i = iRow; i < iRow + iSpan ; i++)
{
_section[iColumn][i] = sFieldName;
}
}
else
{

while(iRow < _section[iColumn].length && _section[iColumn][iRow] == _section[iColumn][iRow+1])
{
iRow++;
}
iRow++;
IncreaseSpan(sFieldName,iColumn,iRow,iSpan);
}
BalanceLengthIncrease(iColumn);
return true;
}
function MoveRightInSchema(sFieldName)
{
var totalRows = _section[0].length;
var position = GetPosition(sFieldName);
var iColumn = position[0];
var thisRow = position[1];

if(thisRow < 0 || iColumn == (_totalColumns - 1))
{
return false;
}
var span = 0;
var iRow = thisRow;
while(_section[iColumn][iRow] == sFieldName && iRow < totalRows)
{
span++;
iRow++;
}
DeleteFromSchema(sFieldName,false);
return InsertAtRowColumn(sFieldName,iColumn + 1,thisRow,span);
}
function ChangeRowSpanInSchema(sFieldName,iOldRowSpan,iNewRowSpan)
{
if(iNewRowSpan > iOldRowSpan)
{
return IncreaseRowSpan(sFieldName,iNewRowSpan - iOldRowSpan);
}
else
{
return DecreaseRowSpan(sFieldName,iOldRowSpan,iNewRowSpan);
}
}
function IncreaseRowSpan(sFieldName,diff)
{
var position = GetPosition(sFieldName);
if(position[1] < 0 ) return false;
IncreaseSpan(sFieldName,position[0],position[1],diff);
BalanceLengthIncrease(position[0]);
return true;
}
function DecreaseRowSpan(sFieldName,iOldRowSpan,iNewRowSpan)
{
var position = GetPosition(sFieldName);
if(position[1] < 0 ) return false;
DecreaseSpan(position[0],position[1],iOldRowSpan,iNewRowSpan);
return true;
}
function IncreaseSpan(sFieldName,iColumn,thisRow,diff)
{
var len = _section[iColumn].length;
var iRow = 0;
_section[iColumn].length = len + diff;

for(iRow = len + diff - 1; iRow >= thisRow + diff ; iRow--)
{
_section[iColumn][iRow] = _section[iColumn][iRow - diff];
}

for(var i=0; i < diff; i++)
{
_section[iColumn][iRow--] = sFieldName;
}
}
function DecreaseSpan(iStartColumn,iStartRow,iOldRowSpan,iNewRowSpan)
{
var len = _section[iStartColumn].length;
var iRow;

var cRowsToShift = len - (iStartRow + iOldRowSpan);
for(iRow = 0; iRow < cRowsToShift; iRow++)
{
_section[iStartColumn][iStartRow + iNewRowSpan + iRow] =
_section[iStartColumn][iStartRow + iOldRowSpan + iRow];
}

var cRowsToRemove = iOldRowSpan - iNewRowSpan;
for(iRow = 0; iRow < cRowsToRemove; iRow++)
{
_section[iStartColumn][len - iRow - 1] = "";
}
RemoveEmptyRows(len);
}
function GetMinimumLength(iLen)
{
var iRow = iLen - 1;
for(; iRow >= 0 ; iRow--)
{
for(var iCol = 0 ; iCol < _totalColumns ; iCol++)
{
if(_section[iCol].length > iRow && _section[iCol][iRow].length > 0)
{
break;
}
}
if(iCol == _totalColumns)
{
iLen--;
}
else
{
break;
}
}
return iLen;
}
function BalanceLengthIncrease(iColumn)
{
var newLen = _section[iColumn].length ;
newLen = GetMinimumLength(newLen);

for(var iCol = 0 ; iCol < _totalColumns ; iCol++)
{
for(var i = _section[iCol].length ; i < newLen ; i ++)
{
_section[iCol][i] = "";
}
_section[iCol].length = newLen;
}
}
